package com.nbicc.dp.web.webpointvaluetype.controller;

import com.nbicc.core.common.RequestPageObj;
import com.nbicc.db.modular.dp.webpointvaluetype.model.WebPointValueType;
import com.nbicc.service.modular.dp.webpointvaluetype.service.WebPointValueTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 * @Author: lilingyan
 */
@Api(value = "dp:任何数据点的类型" , description = "")
@RestController
@RequestMapping("/web/point/value/type")
public class WebPointValueTypeController {

    @Autowired
    private WebPointValueTypeService webPointValueTypeService;

    @ApiOperation(value = "按id查询")
    @GetMapping("/{id:.+}")
    public ResponseEntity<ModelMap> selectBySerialNum(@PathVariable String id){
        return webPointValueTypeService.selectById(id);
    }

    @ApiOperation(value = "分页查询")
    @PostMapping("/find")
    public ResponseEntity<ModelMap> find(@RequestBody RequestPageObj<Map<String,Object>> requestPageObj){
        return webPointValueTypeService.find(requestPageObj);
    }

    @ApiOperation(value = "添加" , notes = "id自动生成")
    @PostMapping
    public ResponseEntity<ModelMap> insert(@RequestBody WebPointValueType webPointValueType){
        return webPointValueTypeService.insert(webPointValueType);
    }

    @ApiOperation(value = "修改", notes = "以id修改(必传)")
    @PutMapping
    public ResponseEntity<ModelMap> updateById(@RequestBody WebPointValueType webPointValueType){
        return webPointValueTypeService.updateById(webPointValueType);
    }

    @ApiOperation(value = "删除", notes = "")
    @DeleteMapping("/{id:.+}")
    public ResponseEntity<ModelMap> deleteById(@PathVariable String id){
        return webPointValueTypeService.deleteById(id);
    }

}
